
/******************************************************************************\
|    Title:        	 TABLE E12: Regression Models for Becoming Lobbyist - 	   |
|						DiD Specification 									   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear
xtset stafferid year

xtset stafferid year

* include 2007 already in treatment period for DiD 
gen posttreat2 = 0
replace posttreat2 = 1 if year>=2007

* no FE
reg lobbydirectafter i.switchtouncovered_treatment##i.posttreat2, vce(cluster stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model1
estadd local fixed "No" , replace


* staffer FE
xtreg lobbydirectafter i.switchtouncovered_treatment##i.posttreat2 i.year, fe vce(cluster stafferid) 
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2
estadd local fixed "Yes" , replace


* no days worked
xtreg lobbydirectafter i.switchtouncovered_treatment##i.posttreat2 committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year, fe vce(cluster stafferid) 
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3
estadd local fixed "Yes" , replace

* days worked
xtreg lobbydirectafter i.switchtouncovered_treatment##i.posttreat2 daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year, fe vce(cluster stafferid) 
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3b
estadd local fixed "Yes" , replace


xtreg lobbydirectafter i.switchtouncovered_treatment##i.posttreat2 daysworked experience_imp  experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year, fe vce(cluster stafferid) 
	summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model4
estadd local fixed "Yes" , replace


esttab model* using "TABLED12.csv", replace ///
	b(3) se(3) star(^§ 0.1 * .05 ** .01 *** 0.001) ///
	stats(fixed ymean N N_g r2, fmt(0 3 0 0 3) labels("Staffer FE" "Mean of DV"  "Observations" "Number of staffers" "R2"))  ///
	nomtitles ///
	order(1.switchtouncovered_treatment#1.posttreat2) ///
	coeflabels(1.switchtouncovered_treatment "Switch to uncovered" 1.posttreat2 "Post-HLOGA" 1.switchtouncovered_treatment#1.posttreat2 "Switch to uncovered \times Post-HLOGA" daysworked "Days worked" experience_imp "Hill experience" experience_sq "Hill experience sq." committeestaff2_everyear "Committee staff" personalstaff_everyear "Personal staff" senate_everyear "Senate staff" majority_everyear "Majority party staff" minority_everyear "Minority party staff" dcoffice_everyear "DC office staff" leaderofficestaff_everyear "Leadership office staff") ///
    label parentheses nogaps nolines noeqlines ///
    noomitted nodepvars nobaselevels indicate("Year FE = *.year") nonotes noconstant
	
	
	
